<template>
  <div id="piebox" style="width: 50%;height: 600px;"></div>
</template>

<script>
export default {
  name: "xgypiechart",
  mounted () {
    var myChart = this.$echarts.init(document.getElementById('piebox'));
    // 指定图表的配置项和数据
    var optionpie = {
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '5%',
        left: 'center',
        icon: 'circle',
      },
      series: [
        {
          name: '总体人数',
          type: 'pie',
          radius: ['40%', '70%'],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 10,
            borderColor: '#fff',
            borderWidth: 2
          },
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '20',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            { value: 20, name: '大一学生人数' },
            { value: 20, name: '大二学生人数' },
            { value: 30, name: '大三学生人数' },
            { value: 30, name: '大四学生人数' },
          ]
        }
      ]
    };
    // 使用刚指定的配置项和数据显示图表。
    setInterval(() => {
      console.log(123);
      myChart.resize();
    }, 100);
    myChart.setOption(optionpie);

  },
}
</script>

<style scoped>
</style>